package info.ask4research.service.impl;

import info.ask4research.dao.IUnitOfLearningDAO;
import info.ask4research.dao.core.AbstractDao;
import info.ask4research.model.UnitOfLearning;
import info.ask4research.model.activities.Activity;
import info.ask4research.service.IUnitOfLearningService;
import info.ask4research.service.core.impl.AbstractServiceImpl;
import info.ask4research.web.dto.UnitOfLearningDTO;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service(value="unitOfLearningService")
@Transactional
public class UnitOfLearningService extends AbstractServiceImpl<UnitOfLearning> implements IUnitOfLearningService{

	@Resource(name = "unitOfLearningDAO")
	private IUnitOfLearningDAO dao;

	@Override
	public AbstractDao<UnitOfLearning> getDao() {
		return dao;
	}

	@Override
	public void setDao(AbstractDao<UnitOfLearning> dao) {
		this.dao = (IUnitOfLearningDAO) dao;
	}
	@Override
	public List<UnitOfLearning> getUnitOfLearningList(){

		return dao.getAll();
	}
	@Override
	public UnitOfLearning create(UnitOfLearning unitOfLearning){
		return dao.save(unitOfLearning);
	}
	@Override
	public UnitOfLearning update(UnitOfLearning unitOfLearning){
		return dao.save(unitOfLearning);
	}
	@Override
	public void delete(UnitOfLearning unitOfLearning ){
		dao.remove(unitOfLearning);
	}
	@Override
	public UnitOfLearning get(int id){
		return dao.get(id);
	}
	@Override
	public List<UnitOfLearning> getUnitOfLearningPaginated(Integer limit,
			Integer page, Integer start) {
		return dao.getUnitOfLearningPaginated(limit,
				page, start);
	}
	@Override
	public List<UnitOfLearningDTO> getUnitOfLearningPaginated(Integer limit,
			Integer page, Integer start, String query) {
		return dao.getUnitOfLearningPaginated(limit,
				page, start, query);
	}

	@Override
	public List<Activity> getActivities(int UoLId) {
		return dao.getActivities(UoLId);
	}

	@Override
	public boolean existByTitle(String title) {
		return dao.existByTitle(title);
	}
		
}
